<template>
  <view class="wrap">
    <view class="wrap-box">
      <view class="title">即将生成的编号是</view>

      <view class="givenumber">{{giveNumbername}}</view>
    </view>
    <view class="btn-box">
      <view class="return" @click="returnClick()">返回再修改</view>
      <view class="confirm" @click="confirmClick()">确认无误</view>
    </view>
  </view>

</template>

<script>
  export default {
    data() {
      return {
        giveData: {

        },
        test: "test",
        giveNumbername: '',
      }
    },
    mounted() {

    },
    onLoad(option) {
      //alert(option.data);
      this.test = "xxx";
      //this.giveData.giveNumber="yyyy";
      this.giveData = JSON.parse(decodeURIComponent(option.data));
      this.giveNumbername = this.giveData.giveNumber;
      console.log(this.giveData);
      //console.log(this.givenumber.giveNumber);
    },
    methods: {
      navigateBack() {
        uni.navigateBack()
      },
      addSub() {

      },
      returnClick() {
        uni.navigateBack()

      },
      confirmClick() {
        var that = this;


that.giveData.userId=this.$store.state.userinfo.id;

        this.$u.api.confirmGiveNumber(that.giveData)
          .then(res => {
			  if(res.code!=200)
			  {
				  uni.showToast({
				    title: res.msg,
				    icon: "none"
				  });
			  }else{
				  uni.navigateTo({
				    url: '/subpackage/tool/givenumber/confirmGiveNumber?data=' + encodeURIComponent(JSON
				      .stringify(that.giveData))
				  });
			  }

          });
      }


    },
  }
</script>

<style lang="scss">
  .wrap {
    margin-left: 20rpx;
    margin-right: 20rpx;
  }

  .wrap-box {
    display: flex;
    flex-direction: column;
    align-items: center;

    .title {
      font-size: 28rpx;
      font-family: PingFang SC;
      color: #333333;
      line-height: 48rpx;
    }

    .givenumber {
      font-size: 40rpx;
      font-family: PingFang SC;
      margin-top: 10rpx;
      color: #333333;
      line-height: 48rpx;
    }
  }

  .btn-box {
    margin-top: 30rpx;
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: space-evenly;

    .return {
      width: 280rpx;
      height: 80rpx;
      background: #3BA2FF;
      border-radius: 40rpx;
      line-height: 80rpx;
      text-align: center;
      font-size: 32rpx;
      font-family: PingFang SC;
      font-weight: 500;
      color: #FFFFFF;
    }

    .confirm {
      width: 280rpx;
      height: 80rpx;
      background: #F9A048;
      border-radius: 40rpx;
      line-height: 80rpx;
      text-align: center;
      font-size: 32rpx;
      font-family: PingFang SC;
      font-weight: 500;
      color: #FFFFFF;
    }
  }

  .btn {
    margin-top: 100rpx;
    margin-left: 10%;
    margin-right: 10%;
    height: 80rpx;
    line-height: 80rpx;
    background: #3BA2FF;
    border-radius: 40px;
    text-align: center;
    font-size: 32rpx;
    font-family: PingFang SC;
    color: #FFFFFF;
  }
</style>
